# 配置Linux平台的Crypto库


if(LINUX)
    # 查找头文件
    find_path(Cryptopp_INCLUDE_DIR
        NAMES md5.h sha.h
        PATHS /usr/include/cryptopp
            /use/local/include/cryptopp
        REQUIRED
    )
    # 查找库文件
    find_library(Cryptopp_LIBRARY
        #/usr/lib/x86_64-linux-gnu/libcryptopp.a
        NAME cryptopp
        HINTS /usr/lib/x86_64-linux-gnu/
        REQUIRED
    )

    if(Cryptopp_LIBRARY AND Crypropp_INCLUDE_DIR)
        set(Cryptopp_FOUND TRUE)
    else()
        set(Cryptopp_FOUND FALSE)
    endif()
    message("Cryptopp_LIBRARYS : " ${Cryptopp_LIBRARY})
    message("Cryptopp_INCLUDE_DIR : " ${Cryptopp_INCLUDE_DIR})
    message("Cryptopp_FOUND : " ${Cryptopp_FOUND})
    # 标准处理
    include(FindPackageHandleStandardArgs)
    find_package_handle_standard_args(Cryptopp
        FOUND_VAR Cryptopp_FOUND
        REQUIRED_VARS Cryptopp_LIBRARY Cryptopp_INCLUDE_DIR
    )

    if(Cryptopp_FOUND AND NOT TARGET Cryptopp::cryptopp)
        add_library(Cryptopp::cryptopp UNKNOWN IMPORTED)
        set_target_properties(Cryptopp::cryptopp PROPERTIES
            IMPORTED_LOCATION ${Cryptopp_LIBRARY}
            INTERFACE_INCLUDE_DIRECTORIES ${Cryptopp_INCLUDE_DIR}
        )
    endif()
else()
    message("NOT Linux Platfrom!")
endif()